SMSGatewayHub Developer API
Complete reference for sending bulk SMS, OTP, Voice calls, and managing delivery reports via our REST API. Supports HTTP GET, JSON POST, and XML POST formats.
Every API request requires your unique APIKey parameter. Your API key is available in your SMSGatewayHub account dashboard under API Settings.
💡 Keep your APIKey private. Never expose it in client-side JavaScript or public repositories.
| Parameter | Type | Description |
| APIKeyrequired |
string |
Your unique API key assigned to your account |
Optionally, restrict API access to specific IP addresses from your account dashboard for additional security.
Standard
200 RPS
Response time: 100–500 ms
HA Cluster
2000 TPS
Response time: 50–150 ms
To upgrade to the HA Cluster infrastructure for higher throughput requirements, contact support@smsgatewayhub.com
All API endpoints are hosted on Cloudflare's serverless environment with SSL/TLS encryption. Additional layers include a Web Application Firewall (WAF), IP-based restrictions, and brute-force monitoring on all dedicated servers.
Data Retention Policy
| Client Type | Retention Period |
| Banking clients | 1 year (as per RBI regulations) |
| All other clients | 6 months, then archived to cold storage (S3) |
Test the SMSGatewayHub API directly from your browser. Enter your credentials and send a real SMS to verify your integration.
Request URL Preview
Fill in the fields above to see the API URL...
⚠️ This tester makes real API calls and will deduct credits from your account.
Don't have an account?
Register for free →
Send a single SMS to one recipient. Supports Text, OTP, Unicode, Flash, Group, and Scheduled delivery.
GET
https://www.smsgatewayhub.com/api/mt/SendSMS
Parameters
| Parameter | Type | Description |
| APIKeyrequired | string | API key for authentication |
| senderidrequired | string | DLT-approved sender ID (6 characters) |
| channelrequired | string | 1=Promotional, 2=Transactional, OTP=OTP, INT=International |
| DCS | string | 0=Normal/English (default), 8=Unicode (Hindi/Regional) |
| flashsms | string | 0=Normal SMS (default), 1=Flash SMS (immediate popup) |
| numberrequired | string | Recipient mobile number with country code (e.g. 91989xxxxxxx) |
| textrequired | string | SMS message content (URL-encode special characters) |
| route | string | Route ID to control delivery path |
| schedtime | string | Scheduled send time — format: yyyy/mm/dd hh:mm:ss PM |
| groupid | string | Contact group ID |
| EntityIdrequired | string | DLT-registered Entity ID |
| dlttemplateidrequired | string | DLT-registered Template ID |
Request Examples
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=2
&DCS=0
&flashsms=0
&number=91989xxxxxxx
&text=test+message
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=2
&DCS=8
&flashsms=0
&number=91989xxxxxxx
&text=%E0%A4%AA%E0%A4%B0%E0%A5%80%E0%A4%95%E0%A5%8D%E0%A4%B7%E0%A4%A3+%E0%A4%B8%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%87%E0%A4%B6
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=2
&DCS=0
&flashsms=1
&number=91989xxxxxxx
&text=test+message
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=OTP
&DCS=0
&flashsms=0
&number=91989xxxxxxx
&text=Your+OTP+is+123456
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=2
&DCS=0
&flashsms=0
&number=91989xxxxxxx
&text=test+message
&schedtime=2025/12/31+22:35:00+PM
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
Response
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047",
"MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}
Send SMS to multiple recipients simultaneously. Pass multiple numbers as comma-separated values in the number parameter. All other parameters are identical to Single SMS API.
GET
https://www.smsgatewayhub.com/api/mt/SendSMS
💡 Separate multiple numbers with commas: number=91989xxxxxxx,91999xxxxxxx,91888xxxxxxx
Example
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=2
&DCS=0
&flashsms=0
&number=91989xxxxxxx,91999xxxxxxx
&text=test+message
&route=1
&EntityId=Registered-Entity-Id
&dlttemplateid=Registered-DLT-Template-Id
Response
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047",
"MessageData":[
{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},
{"Number":"91999xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}
]}
Send SMS to international numbers worldwide. Use channel=INT and pass the full number with country code (without + prefix).
GET
https://www.smsgatewayhub.com/api/mt/SendSMS
⚠️ For international SMS, EntityId and dlttemplateid are NOT required.
Example
https://www.smsgatewayhub.com/api/mt/SendSMS
?APIKey=yourapicode
&senderid=TESTIN
&channel=INT
&DCS=0
&flashsms=0
&number=12093158246
&text=test+message
&route=1
Check available SMS credits in your account in real-time.
GET
https://www.smsgatewayhub.com/api/mt/GetBalance?APIKey=yourapicode
Response
{"ErrorCode":"0","ErrorMessage":"Success","Balance":"Unified Response:9988"}
Check the delivery status of a sent message using the jobid returned from the Send SMS API response.
GET
https://www.smsgatewayhub.com/api/mt/GetDelivery?APIKey=yourapicode&jobid=#######
| Parameter | Type | Description |
| APIKeyrequired | string | API key for authentication |
| jobidrequired | string | Job ID from the Send SMS API response |
Response
{"ErrorCode":"0","ErrorMessage":"Success","MessageId":null,
"DeliveryReports":[
{"MessageId":"mvHdpSyS7UOs9hjxixQLvw","DeliveryStatus":"Delivered","DeliveryDate":"2025-09-28T06:17:00"},
{"MessageId":"PfivClgH20iG6G5R3usHwA","DeliveryStatus":"Delivered","DeliveryDate":"2025-09-28T06:17:00"}
]}
Send SMS via HTTP POST with a JSON body. Set header Content-Type: application/json.
POST
https://www.smsgatewayhub.com/api/mt/SendSMS
Request Body
{
"Account": {
"APIkey": "your-api-key",
"SenderId": "TESTIN",
"Channel": "2",
"DCS": "0",
"SchedTime": null,
"GroupId": null,
"EntityId": "your-entity-id"
},
"Messages": [
{
"Text": "Your message here",
"DLTTemplateId": "your-template-id",
"Number": "91989xxxxxxx"
}
]
}
Send SMS via HTTP POST with an XML body. Set header Content-Type: application/xml.
POST
https://www.smsgatewayhub.com/api/mt/SendSMS
Request Body
<SmsQueue>
<Account>
<APIKey>your-api-key</APIKey>
<SenderId>TESTIN</SenderId>
<Channel>2</Channel>
<EntityId>13011xxxxxxxx</EntityId>
<DCS>0</DCS>
<FlashSms>0</FlashSms>
<Route>1</Route>
</Account>
<Messages>
<Message>
<Number>91989xxxxxxx</Number>
<Text>Your message here</Text>
<DltTemplateId>130716xxxxxxxxx</DltTemplateId>
</Message>
</Messages>
</SmsQueue>
Embed shortened tracking URLs inside your SMS messages. Use #Link1#, #Link2# placeholders in the message text.
Request Body
<SmsQueue>
<Account>
<SenderId>TESTIN</SenderId>
<Channel>Trans</Channel>
<DCS>0</DCS>
<Route>2</Route>
</Account>
<Messages>
<Message>
<Number>91xxxxxxxxxx</Number>
<Text>Hello! Visit #Link1# or #Link2# for more info.</Text>
</Message>
</Messages>
<Links>
<Links><Link>www.google.com</Link></Links>
<Links><Link>www.youtube.com</Link></Links>
</Links>
</SmsQueue>
Response
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"236xxx4430",
"MessageData":[{
"Number": "91xxxxxxxxxx",
"MessageId": "4cK6vS6xxxxxdfN7mBlsOQ",
"Message": "Hello! Visit sg0.co/ARid5 or sg0.co/BRdDV5 for more info."
}]}
Send a text-to-speech (TTS) voice call to a single recipient. Supports Indian English and Hindi voices.
POST
https://vapi.smsgatewayhub.com/tts/3/single
🔐 Authorization: Basic base64(username:password) — pass in the Authorization header.
Parameters
| Parameter | Type | Description |
| fromrequired | string | Caller ID in E.164 format (e.g. 919999999999) |
| torequired | string | Destination number in E.164 format |
| text | string | TTS message text (up to 1400 characters) |
| language | string | Language code — default: en. See Voice Languages section. |
| voice.name | string | Voice name (e.g. Joanna, Aditi, Ravi, Heera) |
| voice.gender | string | male or female |
| audioFileUrl | string | URL to audio file (wav/mp3/ogg, max 4 MB). Use instead of text. |
Request Examples
{
"from": "919999999999",
"to": "916666666666",
"text": "Test Voice message.",
"language": "en",
"voice": { "name": "Joanna", "gender": "female" }
}
curl -X POST \
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \
-H "Content-Type: application/json" \
-d '{"from":"919999999999","to":"916666666666",
"text":"Test Voice message.","language":"en",
"voice":{"name":"Joanna","gender":"female"}}' \
https://vapi.smsgatewayhub.com/tts/3/single
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vapi.smsgatewayhub.com/tts/3/single",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"from" => "919999999999",
"to" => "916666666666",
"text" => "Test Voice message.",
"language" => "en",
"voice" => ["name" => "Joanna", "gender" => "female"]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"Content-Type: application/json"
]
]);
echo curl_exec($curl);
curl_close($curl);
import http.client, json
conn = http.client.HTTPSConnection("vapi.smsgatewayhub.com")
payload = json.dumps({
"from": "919999999999",
"to": "916666666666",
"text": "Test Voice message.",
"language": "en",
"voice": {"name": "Joanna", "gender": "female"}
})
headers = {
"Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"Content-Type": "application/json"
}
conn.request("POST", "/tts/3/single", payload, headers)
print(conn.getresponse().read().decode())
Response
{"messages":[{
"to": "916666666666",
"status": {
"groupId": 1,
"groupName": "PENDING",
"id": 7,
"name": "PENDING_ENROUTE",
"description": "Message sent to next instance"
},
"messageId": "2250be2d4219-3af1-78856-aabe-1362af1edfd2"
}]}
Send voice messages to multiple recipients. Mix TTS text and audio file URLs within the same request batch.
POST
https://vapi.smsgatewayhub.com/tts/3/multi
Request Body
{
"messages": [
{
"from": "919999999999",
"to": ["916666666666", "919999999998"],
"audioFileUrl": "https://www.example.com/media.mp3"
},
{
"from": "919999999999",
"to": ["916666666666"],
"text": "Hello world!",
"language": "en",
"voice": { "name": "Joanna", "gender": "female" }
}
]
}
Full-featured voice API with scheduling, DTMF input, call transfer, retry logic, machine detection, recording, and delivery webhooks.
POST
https://vapi.smsgatewayhub.com/tts/3/advanced
Key Additional Parameters
| Parameter | Type | Description |
| bulkId | string | Unique identifier for the bulk request |
| speechRate | double | Playback speed — range 0.5 to 2.0 (default: 1) |
| notifyUrl | string | Webhook URL for delivery report callbacks |
| validityPeriod | int | Message validity in minutes (max 48 hours = 2880) |
| sendAt | datetime | Scheduled send time in ISO 8601 format |
| record | boolean | Record the call — true or false |
| repeatDtmf | string | DTMF code that triggers message repeat |
| ringTimeout | int | Ring duration before hang-up in seconds (default: 45, max: 45) |
| machineDetection | string | hangup — hang up on machine; continue — play into voicemail |
| retry.minPeriod | int | Minimum retry wait in minutes |
| retry.maxPeriod | int | Maximum retry wait in minutes |
| retry.maxCount | int | Max retry attempts (maximum: 4) |
⚠️ Machine detection is charged additionally. Contact your account manager for pricing.
Call Transfer — Any DTMF
[{ "if": "anyDtmf", "transferTo": "919999999999", "callTransferMaxDuration": 10 }]
Call Transfer — Specific DTMF Keys
[
{ "if": "dtmf", "equals": "1", "transferTo": "919999999999" },
{ "if": "dtmf", "equals": "2", "transferTo": "919999999998" }
]
💡 Add pauses between words using commas in the text field. Each comma = 0.5 seconds pause. Example: "one,,,,two,,,,three"
🔴 Delivery reports are returned ONCE only. Subsequent calls return an empty collection.
GET
https://vapi.smsgatewayhub.com/tts/3/reports
| Parameter | Type | Description |
| bulkId | string | Filter by bulk request ID |
| messageId | string | Filter by specific message ID |
| limit | int | Maximum number of reports to return (default: 50) |
When an incoming missed call arrives at your toll-free or DID number, SMSGatewayHub forwards the call details to your webhook URL via GET request.
WEBHOOK
http://yoursite.com/handler.php?who=%who&ChannelID=%channel&Circle=%circle&Operator=%operator&DateTime=%time
Parameters Forwarded to Your Webhook
| Parameter | Description |
| Caller | Phone number of the caller |
| Channel | Your toll-free or DID number that received the call |
| Circle | Telecom circle of the caller |
| Operator | Caller's mobile operator (Jio, Airtel, Vi, BSNL, etc.) |
| CallTime | Date and time the call was received |
⚠️ Your webhook must respond quickly. Do not return any HTML in the response body — plain text or JSON only.
Quick-start PHP implementation using cURL. Copy and paste, replace your credentials, and you're ready to go.
<?php
$apikey = "YourAPIkey";
$sender = "TESTIN";
$msg = "YOUR MESSAGE HERE";
$num = "91XXXXXXXXX";
// URL-encode the message to handle special characters
$ms = rawurlencode($msg);
$url = "https://www.smsgatewayhub.com/api/mt/SendSMS"
. "?APIKey=$apikey"
. "&senderid=$sender"
. "&channel=2"
. "&DCS=0"
. "&flashsms=0"
. "&number=$num"
. "&text=$ms"
. "&route=1";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['ErrorCode'] === '000') {
echo "SMS sent! Job ID: " . $result['JobId'];
} else {
echo "Error: " . $result['ErrorMessage'];
}
?>
| Error Code | Description |
| 000 | Success |
| 001 | Login details cannot be blank |
| 003 | Sender ID cannot be blank |
| 004 | Message text cannot be blank |
| 005 | Message data cannot be blank |
| 006 | Generic error |
| 007 | Username or password is invalid |
| 008 | Account not active |
| 009 | Account locked — contact your account manager |
| 0010 | API restriction |
| 0011 | IP address restriction |
| 0012 | Invalid message length |
| 0013 | Mobile numbers not valid |
| 0014 | Account locked due to spam — contact support |
| 0015 | Sender ID not valid |
| 0017 | Group ID not valid |
| 0018 | Multi-message to group is not supported |
| 0019 | Schedule date is not valid |
| 0020 | Message or mobile number cannot be blank |
| 0021 | Insufficient credits |
| 0022 | Invalid Job ID |
| 0023 | Parameter missing |
| 0024 | Invalid template or template mismatch |
| 0025 | {Field} cannot be blank or empty |
| 0026 | Invalid date range |
| 0027 | Invalid optin user |
URL-encode these characters when passing them in query string parameters (especially in the text field). Use PHP's rawurlencode() or JavaScript's encodeURIComponent() to handle this automatically.
space%20
!%21
"%22
#%23
$%24
%%25
&%26
'%27
(%28
)%29
*%2A
+%2B
,%2C
-%2D
.%2E
/%2F
:%3A
;%3B
<%3C
=%3D
>%3E
?%3F
@%40
[%5B
\%5C
]%5D
^%5E
`%60
{%7B
|%7C
}%7D
~%7E
English (Indian) en-in
Female:Aditi, Heera ✦, Priya, Raveena
Male:Ravi
Hindi hi
Female:Aadita ✦, Kalpana
Male:Hemant
English (US) en
Female:Joanna ✦, Salli, Kendra, Ivy
Male:Matthew, Justin
✦ = Default voice for language
Common questions from developers integrating the SMSGatewayHub API. Click any question to expand the answer.
Register at smsgatewayhub.com, log in to your panel, and navigate to
API Settings. Your unique
APIKey will be displayed there. Use this key in every API request as the
APIKey parameter. Keep it confidential — never expose it in client-side JavaScript.
DLT (Distributed Ledger Technology) is TRAI's mandatory registration system for all commercial SMS senders in India. Every SMS must include a EntityId (your company's registered DLT ID) and a dlttemplateid (the approved message template ID). Without these, telecom operators will block your messages. Register your entity and templates on the DLT portal of your preferred telecom operator (Jio, Airtel, Vi, BSNL).
Error 0024 means the message text you sent does not match the pattern of your DLT-registered template. Common causes: (1) Variable values contain characters not allowed in the template, (2) Extra spaces or punctuation differ from the approved template, (3) Wrong dlttemplateid used. Solution: compare your actual message text character-by-character with the approved template — the fixed text must match exactly, only the variable placeholders can differ.
Use channel=OTP in your API request. The endpoint remains the same: https://www.smsgatewayhub.com/api/mt/SendSMS. The OTP channel has the highest delivery priority and bypasses DND (Do Not Disturb) filters. You still need a DLT-registered OTP template and EntityId. Example:
...&channel=OTP&text=Your+OTP+is+123456&EntityId=XXX&dlttemplateid=YYY
Set DCS=8 in your API request to enable Unicode encoding. This supports Hindi, Marathi, Gujarati, Tamil, Telugu, Bengali and all other Indian languages. Important: Unicode SMS have a limit of 70 characters per SMS instead of the usual 160 characters for English. For multi-part Unicode SMS, each part can carry 67 characters. Always URL-encode your Unicode text before sending.
Transactional SMS (channel=2) — Used for alerts, notifications, OTPs, and account-related messages. Can be sent to DND numbers. Delivered 24×7.
Promotional SMS (channel=1) — Used for marketing, offers, and advertisements. Cannot be sent to DND numbers. Delivery restricted to 9 AM – 9 PM only.
Both require DLT-registered sender IDs and templates as per TRAI regulations.
Use the DLR (Delivery Report) API with the jobid returned in your send SMS response:
https://www.smsgatewayhub.com/api/mt/GetDelivery?APIKey=YOURKEY&jobid=JOBID
The response will show DeliveryStatus as Delivered, Pending, Failed, or NDNC for each mobile number in the batch.
Use PHP's cURL functions. Always use rawurlencode() on your message text to handle spaces and special characters. See the PHP Sample section above for complete code. Key points: set CURLOPT_SSL_VERIFYPEER to false if you face SSL issues in development (enable it in production), and parse the JSON response with json_decode() to check the ErrorCode field.
Yes. Set channel=INT and include the full number with country code (without the + prefix). For example, a US number: 12093158246, a UK number: 447911123456. The EntityId and dlttemplateid parameters are not required for international SMS. Contact support for international pricing before sending.
Flash SMS appears instantly as a popup on the recipient's screen without being saved to their inbox. Set flashsms=1 to send flash SMS. Best use cases: urgent OTPs where you want the code to disappear after viewing, emergency alerts, and time-sensitive notifications. Note: not all devices and operators support flash SMS equally — use standard SMS (flashsms=0) for maximum compatibility.
Add the schedtime parameter in the format yyyy/mm/dd hh:mm:ss AM/PM. Example:
&schedtime=2025/12/31+10:30:00+AM
The message will be queued and delivered at the specified time. You can schedule bulk SMS campaigns in advance using this feature. To cancel a scheduled SMS, contact support with the jobid.
Log in to your SMSGatewayHub panel and go to Account Settings → API Security. Add your server's IP address(es) to the whitelist. Once enabled, API requests from any other IP will receive error code 0011 (IP address restriction). This is strongly recommended for production environments to prevent unauthorized use of your API key.
Standard accounts support up to
200 requests per second (RPS) with 100–500ms response times. For high-volume requirements, the HA (High Availability) Cluster supports
2000 transactions per second (TPS) with 50–150ms response times. To upgrade, contact
support@smsgatewayhub.com with your expected daily volume.
Two options: (1) Comma-separated numbers — pass multiple numbers in the number parameter separated by commas. (2) Contact Group — create a contact group in your panel, note the Group ID, and pass it in the groupid parameter. The group method is easier for recurring campaigns where the recipient list doesn't change.